package cn.itcast.zuoyebang.fragment.table2fragment;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

import cn.itcast.zuoyebang.R;
import cn.itcast.zuoyebang.bean.Exercise;


public class Table2Fragment extends Fragment {

    List<Exercise> exerciseList = new ArrayList<>();


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_table2, container, false);
        ListView listView = view.findViewById(R.id.lv);
        initExercise();
        ExerciseAdapter adapter = new ExerciseAdapter(exerciseList,getContext());
        listView.setAdapter(adapter);
        return view;
    }

    private void initExercise() {

        exerciseList.add(new Exercise(0,"第一章 Android基础入门",0,"https://ks.wjx.top/vj/Pp4rufh.aspx"));
        exerciseList.add(new Exercise(0,"第一章 Android基础入门",1,"https://ks.wjx.top/vj/Pp4rufh.aspx"));
        exerciseList.add(new Exercise(0,"第一章 Android基础入门",2,"https://ks.wjx.top/vj/Pp4rufh.aspx"));
        exerciseList.add(new Exercise(0,"第一章 Android基础入门",3,"https://ks.wjx.top/vj/Pp4rufh.aspx"));
    }
}